package com.tutor.mapper;


import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tutor.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.io.Serializable;


@Mapper
public interface UserMapper extends BaseMapper<User> {

    @Select("select * from user ${ew.customSqlSegment}")
    Page pageCC(Page<User> page, @Param(Constants.WRAPPER) Wrapper wrapper);

    @Update("update user set password = #{password} where(name = #{name} and phone = #{phone})")
    void updatePassword(User user);

    @Select("select phone from user where name = #{name}")
    String getPhoneByName(User user);

    @Select("select count(*) from user where no = #{no}")
    Integer selectByNo(User user);
}
